package jman.competition16;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class Service {
	public boolean order(int number,String dishName,int price){
		boolean flag=false;
		Menu menu=new Menu(number,dishName,price,"未上菜");
		MenuDao md=new MenuDao();
		flag=md.add(menu);
		return flag;
	}
	public boolean cancel(int id){
		boolean flag=false;
		MenuDao md=new MenuDao();
		flag=md.delete(id);
		return flag;
	}
	public boolean finishMenu(int id){
		boolean flag=false;
		MenuDao md=new MenuDao();
		flag=md.updateStatus(id);
		return flag;
	}
	public List<Menu> MenusView() throws SQLException{
		List<Menu> menuList=new ArrayList<Menu>();
		MenuDao md=new MenuDao();
		menuList=md.getListForCooker();
		return menuList;
	}
	public List<Menu> orderView(int number) throws SQLException{
		List<Menu> menuList=new ArrayList<Menu>();
		MenuDao md=new MenuDao();
		menuList=md.getListForCustomer(number);
		return menuList;
	}
}
